<?xml version="1.0" encoding="utf-8" ?>
<xs:schema
    targetNamespace="urn:deployment-usergroupmap-schema"
    elementFormDefault="qualified"
    xmlns="urn:deployment-usergroupmap-schema"
    xmlns:mstns="urn:deployment-usergroupmap-schema"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <!-- DeploymentUser definition -->
    <xs:complexType name="DeploymentUser">
        <xs:attribute name="Id" type="xs:string" use="required" />
        <xs:attribute name="Name" type="xs:string" use="required" />
        <xs:attribute name="Login" type="xs:string" use="required" />
        <xs:attribute name="Email" type="xs:string" use="optional" />
        <xs:attribute name="IsDomainGroup" type="xs:boolean" use="optional" />
        <xs:attribute name="IsSiteAdmin" type="xs:boolean" use="optional" />
        <xs:attribute name="SystemId" type="xs:string" use="required" />
        <xs:attribute name="IsDeleted" type="xs:boolean" use="required" />
        <xs:attribute name="MobilePhone" type="xs:string" use="optional" />
        <xs:attribute name="Flags" type="xs:int" use="optional" />
    </xs:complexType>

    <!-- DeploymentUsers definition -->
    <xs:complexType name="DeploymentUsers">
        <xs:sequence>
            <xs:element name="User" type="DeploymentUser" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <!-- DeploymentGroupMember definition -->
    <xs:complexType name="DeploymentGroupMember">
        <xs:sequence/>
        <xs:attribute name="UserId" type="xs:string" />
    </xs:complexType>

    <!-- DeploymentGroup definition -->
    <xs:complexType name="DeploymentGroup">
        <xs:sequence>
            <xs:element name="Member" type="DeploymentGroupMember" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
        <xs:attribute name="Id" type="xs:string" use="required" />
        <xs:attribute name="Name" type="xs:string" use="required" />
        <xs:attribute name="Owner" type="xs:string" use="required" />
        <xs:attribute name="OwnerIsUser" type="xs:boolean" use="required" />
        <xs:attribute name="Description" type="xs:string" use="optional" />
        <xs:attribute name="OnlyAllowMembersViewMembership" type="xs:boolean" use="optional" />
        <xs:attribute name="AllowMembersEditMembership" type="xs:boolean" use="optional" />
        <xs:attribute name="AllowRequestToJoinLeave" type="xs:boolean" use="optional" />
        <xs:attribute name="AutoAcceptRequestToJoinLeave" type="xs:boolean" use="optional" />
        <xs:attribute name="RequestToJoinLeaveEmailSetting" type="xs:string" use="optional" />
    </xs:complexType>

    <!-- DeploymentGroups definition -->
    <xs:complexType name="DeploymentGroups">
        <xs:sequence>
            <xs:element name="Group" type="DeploymentGroup" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="DeploymentUserGroupMap">
        <xs:sequence>
            <xs:element name="Users" type="DeploymentUsers" minOccurs="0" maxOccurs="1" />
            <xs:element name="Groups" type="DeploymentGroups" minOccurs="0" maxOccurs="1" />
        </xs:sequence>
    </xs:complexType>

    <!-- Root element -->
    <xs:element name="UserGroupMap" type="DeploymentUserGroupMap" />

</xs:schema>
